<template>
  <div class="announcementDetail">
    <!--  顶部导航  -->
    <HeaderSimple
      page="userInformation"
      :title="title"
      @goBack="$router.go(-1)"
    ></HeaderSimple>

    <!--  内容  -->
    <div class="section">
      <div class="title">{{ announcementDetail.title }}</div>
      <p class="info">
        {{ announcementDetail.nickname }}
        <span style="color: #888888;">{{ updatetime }}</span>
      </p>
      <p class="content">{{ announcementDetail.content }}</p>
      <van-image class="img" :src="announcementDetail.images" />
    </div>
  </div>
</template>

<script>
import { Image } from "Vant";
import HeaderSimple from "@/components/HeaderSimple";
export default {
  name: "announcementDetail",
  components: {
    HeaderSimple
  },
  data() {
    return {
      id: "",
      announcementDetail: {},
      updatetime: ""
    };
  },
  created() {
    this.title = this.$route.meta.title;
    this.id = this.$route.query.id;
    this.getAnnouncementDetail();
  },
  methods: {
    // 获取公告详情
    getAnnouncementDetail() {
      this.$axios
        .get(`/api/index/announcementDetail?id=${this.id}`)
        .then(res => {
          console.log(res);
          if (res.data.code === 1) {
            this.announcementDetail = res.data.data;
            let time = new Date(res.data.data.updatetime);
            this.updatetime = this.mixin.fomatDate(time);
          }
        });
    }
  }
};
</script>

<style scoped lang="less">
@deep: ~">>>";
.announcementDetail {
  width: 100%;
  .header {
    width: 100%;
    height: 100px;
    padding: 30px;

    @{deep} .van-nav-bar__left,
    .van-nav-bar__right {
      position: absolute;
      top: 30px;
    }

    @{deep} .van-nav-bar__title {
      font-size: 36px;
      font-family: SourceHanSansCN;
      font-weight: 600;
      color: rgba(51, 51, 51, 1);
    }

    @{deep} .van-icon {
      font-size: 38px;
      font-weight: 500;
      color: rgba(51, 51, 51, 1);
    }
  }
  .section {
    width: 100%;
    min-height: 1204px;
    margin-top: 30px;
    padding: 40px 30px;
    background: rgba(255, 255, 255, 1);
    .title {
      font-size: 42px;
      font-family: SourceHanSansCN;
      font-weight: 600;
      color: rgba(51, 51, 51, 1);
      line-height: 55px;
    }
    .info {
      margin-top: 10px;
      font-size: 24px;
      font-family: SourceHanSansCN;
      font-weight: 400;
      color: rgba(75, 91, 141, 1);
      line-height: 55px;
    }
    .content {
      margin-top: 30px;
      font-size: 34px;
      font-family: SourceHanSansCN;
      font-weight: 400;
      color: rgba(51, 51, 51, 1);
      line-height: 60px;
    }
    .img {
      margin-top: 45px;
      width: 100%;
      height: 600px;
    }
  }
}
</style>
